<?php
// echo $_SERVER['PHP_SELF'];
// this code gives the path of current file
// that sets our current form's action to this file itself.

if (isset($_POST['username'])) {
    $username = $_POST['username'];
}

if (isset($_POST['password'])) {
    $password = $_POST['password'];
}

if ($username != "" && $password != "") {


    mysql_connect("localhost","root","");
    mysql_select_db("susudo");
    $query="SELECT * FROM users WHERE username='$username' AND password='$password'" ;
    $result=mysql_query($query);
    if (mysql_num_rows($result)>0) {
        //echo "LOGIN SUCCESS";
        header("location: profile.php");
       
    }
    else {
        echo "LOGIN FAILED";
    }
}
else {
        echo "<p style='color:red'>Please provide all ur infromation along with comment </p>";
    }
mysql_close();
?>
